
package com.sgcc.system.api.factory;

import com.sgcc.common.core.domain.R;
import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.system.api.RemoteDictDataService;
import com.sgcc.system.api.RemoteFileService;
import com.sgcc.system.api.domain.SysFile;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务降级处理
 * 
 * @author sgcc
 */
@Component
public class RemoteDictDataFallbackFactory implements FallbackFactory<RemoteDictDataService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteDictDataFallbackFactory.class);

    @Override
    public RemoteDictDataService create(Throwable throwable)
    {
        log.error("失败:{}", throwable.getMessage());
        return new RemoteDictDataService()
        {
            @Override
            public R getIdStr(String dictType, String label) {
                return R.fail("获取id失败");
            }

            @Override
            public R selectDictDataByType(String dictType) {
                return null;
            }

            @Override
            public AjaxResult dictType(String dictType) {
                return AjaxResult.error("获取列表失败~");
            }

            @Override
            public String getLabel(String dictType, String vaule) {
                return null;
            }
        };
    }
}
